#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
const int N=1e5+10;

int h[N*2],to[N*2],ne[N*2],idx;
int dist_l[N],dist_r[N];
void add(int x,int y)
{
	ne[idx]=h[x];
	to[idx]=y;
	h[x]=idx++;
}
void bfs(int fa,int* dist)
{
	cout<<sizeof(dist)<<endl;
	cout<<sizeof(dist_l)<<endl;
	memset(dist,0x3f,sizeof(dist_l));
	queue<int> q;
	q.push(fa);
	dist[fa]=0;
	while(q.size())
	{
		int u=q.front();
		q.pop();
		for(int i=h[u];~i;i=ne[i])
		{
			int j=to[i];
			if(dist[j]>dist[u]+1)
			{
				dist[j]=dist[u]+1;
				q.push(j);
			}
		}
	}
}
int main()
{
	int n,w;
	cin>>n>>w;
	memset(h,-1,sizeof(h));
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}

	int x,y;
	cin>>x>>y;
	bfs(x,dist_l);
	bfs(y,dist_r);
	int ret=0;
	for(int i=1;i<=n;i++)
	{
		ret+=min(dist_l[i],dist_r[i])*w;
	}
	cout<<ret<<endl;
	return 0;
}
